fix(desktop): backfill SSH_AUTH_SOCK from login shell on macOS#972
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR extends the shared “read env from login shell” utility so the macOS desktop app can hydrate more than just PATH at startup, specifically backfilling SSH_AUTH_SOCK when it’s missing (e.g., Finder/Dock launches) while preserving inherited values when present.
Changes:
- Replaced the desktop-only
fixPath()hook withsyncShellEnvironment()and wired it into desktop startup. - Generalized the shared login-shell probe to support reading multiple environment variables (used for
PATH+SSH_AUTH_SOCK). - Added unit tests for the shared shell helper and for desktop macOS/no-op/regression behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/shared/src/shell.ts | Adds multi-variable login-shell environment capture/extraction and reimplements readPathFromLoginShell on top of it. |
| packages/shared/src/shell.test.ts | Updates PATH probe test markers and adds tests for multi-variable extraction behavior. |
| apps/desktop/src/syncShellEnvironment.ts | New macOS-only startup hook to sync PATH and backfill missing SSH_AUTH_SOCK. |
| apps/desktop/src/syncShellEnvironment.test.ts | Adds tests for macOS hydration, preservation of inherited SSH_AUTH_SOCK, omission behavior, and non-macOS no-op. |
| apps/desktop/src/main.ts | Switches startup hook from fixPath() to syncShellEnvironment(). |
| apps/desktop/src/fixPath.ts | Removes the previous desktop-only PATH fix implementation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Can confirm this fixed git over ssh for me cc @juliusmarminge |
apps/desktop/src/fixPath.ts
Outdated
There was a problem hiding this comment.
There was a problem hiding this comment.
The Electron app fixes its env first and the bundled backend inherits that via ...process.env when spawned so the desktop path is covered
There was a problem hiding this comment.
os-jank.ts and the Linux report in #971 might be follow up scope
…opagation Merges fix/desktop-ssh-auth-sock for SSH agent socket backfill on macOS. Extends server fixPath() to also read NODE_EXTRA_CA_CERTS and SSL_CERT_FILE from the login shell, with a fallback to /etc/ssl/cert.pem on macOS, so that the Claude Agent SDK can verify TLS certificate chains when launched from Finder/Dock where the process environment is minimal. Also enables Claude Code in the provider model picker by removing the explicit filter that excluded it from available providers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…otgg#972) Co-authored-by: Julius Marminge <julius0216@outlook.com>
…otgg#972) Co-authored-by: Julius Marminge <julius0216@outlook.com>
Closes #971.
What Changed
fixPath()startup hook withsyncShellEnvironment()PATHPATHon macOS startup, but only backfillSSH_AUTH_SOCKwhen it is missingSSH_AUTH_SOCKmust be preservedWhy
The macOS desktop app currently repairs
PATHfrom the login shell, but Finder and Dock launches can still missSSH_AUTH_SOCK. That breaks Git-over-SSH flows in the desktop app even when the same repo works correctly from Terminal.This keeps the fix small and reliability-focused:
SSH_AUTH_SOCKinstead of being overwritten by a different login-shell valueUI Changes
None.
Checklist
Note
Backfill SSH_AUTH_SOCK from login shell on macOS desktop startup
fixPathwith a newsyncShellEnvironmentmodule that reads bothPATHandSSH_AUTH_SOCKfrom the user's login shell on macOS at startup.SSH_AUTH_SOCKis only written if it is not already set in the inherited environment;PATHis always updated from the shell.readEnvironmentFromLoginShellinpackages/shared/src/shell.tsto capture multiple named variables in a single shell invocation using bracketed markers andprintenv <NAME> || true.Macroscope summarized 90d9c4f.